public class Test11 {
    //饿汉模式
    static class Single1{
        //私有构造方法
        private Single1(){}
        private static Single1 instance = new Single1();
        public static Single1 getInstance(){
            return instance;
        }
        public void fun1(){
            System.out.println("没错 是我");
        }
    }

    public static void main(String[] args) {
        Single1 single = Single1.getInstance();
    }
}
